package com.cskaoyan.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author stone
 * @date 2022/11/15 21:00
 */
@EnableWebMvc
@ComponentScan("com.cskaoyan.controller")
public class WebConfiguration implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //  /** SpringMVC中的特殊的写法，多级任意url → /pic/banner.png  /pic/tmp/banner.png

        registry.addResourceHandler("/pic1/**").addResourceLocations("classpath:/");
        registry.addResourceHandler("/pic2/**").addResourceLocations("/");
        registry.addResourceHandler("/pic3/**").addResourceLocations("file:d:/spring/");
    }
}
